package cn.edu.dao.impl;

import cn.edu.dao.StudentDao;
import cn.edu.pojo.Student;

import java.util.List;

public class StudentDaoImpl extends BaseDao implements StudentDao{
    @Override
    public Student queryStudentBySno(String sno) {
        String sql = "select sno,birth,sname,password,sex from Student where sno=?";
        return queryForOne(Student.class,sql,sno);
    }

    @Override
    public int savaStudent(Student student) {
        String sql="insert into Student(sno,sname,sex,birth,password) values(?,?,?,?,?)";
        return update(sql,student.getSno(),student.getSname(),student.getSex(),student.getBirth(),student.getPassword());
    }

    @Override
    public Student queryStudentBySnoAndPassword(String sno, String password) {
        String sql = "select sno,sname,sex,password,birth from student where sno=? and password=?";
        return queryForOne(Student.class,sql,sno,password);
    }
}
